package com.lhh.service;


import com.lhh.entity.User;
import com.lhh.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.*;

@Service
public class UserService {

    @Autowired
    public UserMapper userMapper;

    //根据用户名查找
    public User selectByName(String userName){
        return userMapper.getUserByName(userName);
    }

    //根据邮箱查找
    public User getUserByEmail(String email){
        return userMapper.getUserByEmail(email);
    }

    //根据id查找
    public User getInfo(Integer id){
        return userMapper.getInfo(id);
    }

    //注册
    public int insert(User user){
        return userMapper.addUser(user);
    }

//    修改用户信息
    public int update(User user){
        return userMapper.updateUser(user);
    }

    //修改用户密码和token和修改时间
    public int modifypassword(User user) {return userMapper.modifypassword(user);}
}
